package com.yt.dao;

import com.yt.entity.Account;
import org.apache.ibatis.annotations.*;

/**
 * @Classname AccountDao
 * @Description
 * @Date 2021/11/2 16:04
 * @Create by 杨涛
 */
@Mapper
public interface AccountDao {

    @Results(id = "t_account",value = {
            @Result(id = true,column ="id" ,property ="id" ),
            @Result(column = "user_id" ,property = "userId"),
            @Result(column = "total",property = "total"),
            @Result(column = "used",property = "used"),
            @Result(column = "residue",property = "residue")
    })
    @Select("select * from t_account where user_id = #{userId}")
    Account getAccountByuserId(@Param("userId") Long userId);

    @Update("update t_account set total =#{total},used =#{used},residue=#{residue} where user_id=#{userId}")
    int updateAccount(Account account);
}
